﻿#include <QGuiApplication>
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QWindow>
#include "capture.h"
#include <MyWidget.h>
#include <QDebug>

int main(int argc, char *argv[])
{
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

    QApplication app(argc, argv);

//    MyWidget widget;
//    qDebug() << widget.isTopLevel();
//    widget.show();
    QQmlApplicationEngine engine;

    QWindow window;
//    window.show();
    qDebug() << "is top" << window.isTopLevel();




    QWindow window1(&window);
//    window1.show();
    qDebug() << "is top" << window1.isTopLevel();

    app.setProperty("engine",reinterpret_cast<int>(&engine));

    qmlRegisterType<Capture>("Capture",1,0,"Capture");
    qmlRegisterType<MyWidget>("MyWidget",1,0,"MyWidget");

    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

    if (engine.rootObjects().isEmpty())
        return -1;

    return app.exec();
}
